package com.example.aabb;


import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;

public class SealCreator {
    public static Bitmap createSeal(int width, int height) {
        Bitmap sealBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(sealBitmap);

        // 绘制红色圆形
        Paint paint = new Paint();
        paint.setColor(Color.RED);
        paint.setStyle(Paint.Style.FILL);
        canvas.drawCircle(width / 2f, height / 2f, Math.min(width, height) / 2f, paint);

        // 绘制白色文字
        paint.setColor(Color.WHITE);
        paint.setTextSize(20);
        String text = "已审核";
        Rect bounds = new Rect();
        paint.getTextBounds(text, 0, text.length(), bounds);
        canvas.drawText(text, (width - bounds.width()) / 2f, (height + bounds.height()) / 2f, paint);

        return sealBitmap;
    }
}